﻿using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;

namespace SuppKids.IoC.Installers
{
    public class WindowsInstaller:IWindsorInstaller
    {
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.Register(FindTypes().Configure(x => x.LifeStyle.Transient.Configuration()));
        }

        private static BasedOnDescriptor FindTypes()
        {
            var res = Types.FromAssemblyContaining(typeof (BaseWindow))
                .BasedOn(typeof (BaseWindow))
                .WithService
                .Self();

            return res;
        }
    }
}